// 尺寸信息
@use 'sass:math';

@use 'mixins/function' as *;
@use 'mixins/mixins' as *;

/* 宽高尺寸 start */
@each $type in ('w', 'h') {
  $attr: if($type == 'w', 'width', 'height');
  @include b($type) {
    &-0 {
      #{$attr}: 0px;
    }
    &-px {
      #{$attr}: 1px;
    }
    @for $i from 2 through 12 {
      @if index((2, 3, 4, 5, 6, 12), $i) {
        @for $j from 1 to $i {
          $classname: '#{$j}-#{$i}';
          &-#{$classname} {
            #{$attr}: percentage(math.div($j, $i));
          }
        }
      }
    }
    &-auto {
      #{$attr}: auto;
    }
    &-full {
      #{$attr}: 100%;
    }
    &-screen {
      $value: if($type == 'w', 100vw, 100vh);
      #{$attr}: $value;
    }
    @if ($type == 'w') {
      &-min {
        #{$attr}: min-content;
      }
      &-max {
        #{$attr}: max-content;
      }
    }
  }
}
/* 宽高尺寸 end */

/* 内外边距 start */
@each $type in ('p', 'm') {
  $attr: if($type == 'p', 'padding', 'margin');
  $sub-attrs: (('', ''), (t, top), (r, right), (b, bottom), (l, left));
  @each $sub-attr in $sub-attrs {
    @include b($type + nth($sub-attr, 1)) {
      @each $size in ('default', 'xs', 'sm', 'lg', 'xl', '0') {
        $classname: if($size == 'default', '', '-' + $size);
        &#{$classname} {
          #{$attr + if(nth($sub-attr, 2) == '', '', '-' + nth($sub-attr, 2))}: getCssVar(
            'pm-size',
            if($size == 'default', '', $size)
          );
        }
      }
    }
  }
}
/* 内外边距 end */
